/**
 * 泛娱区块链 - AuthorRecommendItem
 * http://menger.me
 * @大梦
 */


'use strict';

import React from 'react'
import {StyleSheet, Text, TouchableOpacity, View,} from 'react-native'
import Images from "../../asset";
import ImageView from "../common/ImageView";
import {HorizontalLine} from "../common/CommonLine";

export default class AuthorRecommendItem extends React.PureComponent {

    static defaultProps = {
        item: {},
    };

    constructor(props) {
        super(props);
        this.state = {};
    }

    componentDidMount() {
    }

    render() {
        let {item, style, onPressFollowed} = this.props;
        return (
            <View style={[styles.authorItemView, style]}>
                <ImageView
                    resizeMode={'cover'}
                    style={styles.authorImg}
                    source={item.user_img ? {uri: item.user_img} : Images.icon_default_avatar}
                />
                <Text numberOfLines={1} style={styles.authorName}>{item.user_nickname}</Text>
                <Text numberOfLines={1} style={styles.authorDec}>{item.user_remark}</Text>
                <HorizontalLine style={styles.sep}/>
                <TouchableOpacity
                    onPress={onPressFollowed}
                    style={styles.btnView}
                >
                    <Text style={styles.watchText}>{item.focus_state ? '已关注' : '关注'}</Text>
                </TouchableOpacity>
            </View>
        );
    }
}

const itemSize = (SCREEN_WIDTH - 50) / 4;

const styles = StyleSheet.create({
    authorItemView: {
        width: itemSize,
        // height: itemSize * 1.3,
        borderWidth: Theme.minPixel,
        borderRadius: 5,
        paddingTop: 8,
        alignItems: 'center',
        justifyContent: 'space-between',
        borderStyle: "solid",
        borderColor: "#dbdbdb",
    },
    authorImg: {
        width: 36,
        height: 36,
        borderRadius: 36 / 2,
    },
    authorName: {
        height: 15,
        marginTop: 5,
        lineHeight: 15,
        // backgroundColor: '#f60',
        fontSize: FontSize(10),
        color: "#333",
    },
    authorDec: {
        height: 15,
        lineHeight: 15,
        fontSize: FontSize(7),
        color: "#bababa",
    },
    authorLine: {
        color: '#dbdbdb',
        marginTop: 4,
        alignSelf: 'stretch',
    },
    sep: {
        width: itemSize,
        backgroundColor: '#ddd',
    },
    btnView: {
        paddingVertical: 10,
        width: itemSize,
        alignItems: 'center',
        // backgroundColor: '#123',
        justifyContent: 'center',
    },
    watchText: {
        fontSize: FontSize(10),
        color: "#ffa235",
    },
});